#!/bin/bash

rec -q -r 16000 -b 16 -c 1 test.wav
sox test.wav test.flac gain -n -5 silence 1 5 2%
TEXT=`curl --data-binary @test.flac --header 'Content-type: audio/x-flac; rate=16000' 'https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&pfilter=2&lang=es-AR&maxresults=2'`
play -q test.flac
rm test.wav test.flac
echo $TEXT
